package jacob;

import java.util.Random;

import com.idTech.iDTechModBaseJacob;

import net.minecraft.block.BlockTNT;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLiving;
import net.minecraft.util.Icon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

public class Bigtnt extends BlockTNT
{

	public Bigtnt(int par1, Material tnt) 
	{
		super(par1);
		// TODO Auto-generated constructor stub
            this.setCreativeTab(CreativeTabs.tabRedstone);

    }
	/**
     * From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
     */
    public Icon getIcon(int par1, int par2)
    {
    	 if (par1 == 1)
         {
             return this.top_icon;
         }
         else if (par1 == 0)
         {
         	return this.bottom_icon;
         }
         else
         {
             return this.blockIcon;
         }
    }
	/**
     * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
     */
    public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
    {
    	 if (par5 == 1)
         {
             return this.top_icon;
         }
         else if (par5 == 0)
         {
         	return this.bottom_icon;
         }
         else
         {
             return this.blockIcon;
         }
    }

	public void func_94391_a(World par1World, int par2, int par3, int par4, int par5, EntityLiving par6EntityLiving) 
	{
            if (!par1World.isRemote) 
            {
                    if ((par5 & 1) == 1) 
                    {
                            EntityBigtnt entitytntprimed = new EntityBigtnt(
                                            par1World, (double) ((float) par2 + 0.5F),
                                            (double) ((float) par3 + 0.5F),
                                            (double) ((float) par4 + 0.5F), par6EntityLiving);
                            par1World.spawnEntityInWorld(entitytntprimed);
                            par1World.playSoundAtEntity(entitytntprimed, "random.fuse",
                                            1.0F, 1.0F);
                    }
            }
    }

    public int idDropped(int par1, Random par2Random, int par3) 
    {
            return iDTechModBaseJacob.Bigtnt.blockID;
    }

    public void registerIcons(IconRegister iconReg) 
    {
            blockIcon = iconReg.registerIcon("iDTechModBase:tnt_side-Recovered");
            top_icon = iconReg.registerIcon("iDTechModBase:tnt_top");
            bottom_icon = iconReg.registerIcon("iDTechModBase:tnt_bottom");
    }
    
    private Icon top_icon = null;
    private Icon bottom_icon = null;

}

